<template>
  <div>
    <div>
      <van-nav-bar>
        <template #title>
          <router-link to="">9484894</router-link>
        </template>
        <template #left>
          <van-icon name="arrow-left" size="20" @click="cdd"/>
        </template>
      </van-nav-bar>
    </div>
    <div>
      <van-tabs v-model="active" sticky>
        <van-tab v-for="index in acc" :title="index" :key="index">
            <div v-if="index === '最近发布'">2</div>
            <div v-if="index === '最近回复'">3</div>
            <div v-if="index === '精选帖子'">4</div>
        </van-tab>
      </van-tabs>
    </div>
  </div>
</template>
<script>
let kp = ''
export default {
  data() {
    return {
      acc:[
    '最近发布','最近回复','精选帖子'
      ],
      active:0
    };
  },
  beforeRouteEnter (to, from, next) {
    // 在渲染该组件的对应路由被 confirm 前调用
    // 不！能！获取组件实例 `this`
    // 因为当守卫执行前，组件实例还没被创建
    // console.log(from)
    kp =from.fullPath;
    next();
  },
  methods: {
      cdd(){
          this.$router.push({
              path:kp
          })
      }
  },
};
</script>
<style scoped>
</style>